package com.leyantech.ecp.agenx.common.message;

import lombok.Getter;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * websocket 的fn 类型.
 *
 * @author dongxu.ma, {@literal <dongxu.ma@leyantech.com>}
 * @date 2020-12-16.
 */
@Getter
public enum EnumWsFnType {

  NORMAL_BUYER_MSG("Dialogue.SyncMessagesV2", "一般买家问题，由客户端透传."),
  DIALOGUE_ANSWER_REPLY("Dialogue.AnswerReply", "dialogue 响应回复."),
  AGENT_QUERY_ORDER_BUYER_INFO("Agent.QueryOrderBuyerInfo", "查询订单中的买家信息."),
  AGENT_ASSISTANT_CONFIG("Agent.AssistantConfig", "客服配置."),
  AGENT_NOTICE_MSG("Agent.NoticeMsg", "通知类消息"),
  AGENT_BUSINESS_CONFIG_MSG("Agent.BusinessConfig", "业务类配置消息"),
  AGENT_CLIENT_CONFIG("Agent.ClientConfig", "客户端配置下发."),

  ASSISTANT_LOGIN("LOGIN", "客服登录."),

  ASSISTANT_LOGOUT("LOGOUT", "客服登出/长连接停机、重启."),
  ;

  // 类型
  public final String type;
  // 备注
  public final String remark;

  EnumWsFnType(String type, String remark) {
    this.type = type;
    this.remark = remark;
  }

  public static final List<String> FN_LIST = Arrays.stream(EnumWsFnType.values())
      .map(EnumWsFnType::getType)
      .collect(Collectors.toList());

  public static boolean contains(String fn) {
    return FN_LIST.contains(fn);
  }

}
